package cc.fs.study.utils;

import android.view.View;

/**
 * view基本操作
 */
public class ViewUtils {

    /**获取宽度*/
    public static int getWidth(View view) {
        view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
                View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
        return view.getWidth();
    }

    /**获取高度*/
    public static int getHeight(View view) {
        view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
                View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
        return view.getHeight();
    }

}
